<?php 
class Member_model extends CI_Model
{
	private $table = 'member';
	
	
	public function __construct()
	{
		parent::__construct();
	}
	
	public function add_member($data)
	{
		if( $data ) {
			$this->db->insert($this->table, $data);
		}
	}
	
	public function get_member_by_name($name)
	{
		if( $name ) {
			$this->db->select('*');
			$this->db->from($this->table);
			$this->db->where('name', $name);
			$rs = $this->db->get();
			
			if( $rs ) {
				return $rs->row();
			}
		}
		
		return false;
	}
	
	public function get_member_by_id($id)
	{
		if( $id ) {
			$sql = "SELECT * FROM {$this->table} WHERE id = ?";
			return $this->db->query($sql, array($id))->row();
		}
	}
}
?>